package cn.cxyxj.study110.mapper;

import cn.cxyxj.study110.entity.SysMenu;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Set;
import java.util.stream.Stream;


/**
 * 系统菜单表 Mapper 接口
 * @author cxyxj
 * @since 2022-11-03
 */
public interface SysMenuMapper extends BaseMapper<SysMenu> {

    /**
     * 根据接口Url查询角色名称集合
     */
    @Select("SELECT sr.role_name FROM sys_menu sm LEFT JOIN sys_role_menu_middle srmm  on sm.id = srmm.menu_id LEFT " +
            "JOIN sys_role sr  on sr.id = srmm.role_id WHERE sm.api_url = #{apiUrl}")
    List<String> getRolesByUrl(String requestUrl);


    Set<String> seleteByRoleId(@Param("roleIds") List<Integer> roleIds);
}

